"use strict";
cc._RF.push(module, 'a3cf2vkN/NDUYV/rLljL1JQ', 'NumberAction');
// scripts/NumberAction.js

"use strict";

var t = require;
var e = module;
var o = exports;
var i;
Object.defineProperty(o, "__esModule", {
  value: !0
}), o.runNumberActions = o.NumberAction = o.EASING = void 0, function (t) {
  t[t.LINEAR = 0] = "LINEAR", t[t.INVERSE_PROPORTIONAL = 1] = "INVERSE_PROPORTIONAL";
}(i = o.EASING || (o.EASING = {}));
o.NumberAction = function (t, e, o, i, n, a) {
  this.targetNumber = t, this.curNumber = e, this.interval = o, this.component = i, this.onChange = n, this.time_elapsed = 0, this.onChange(this.curNumber), this.finish = a || function () {};
}, o.runNumberActions = function t(e, o) {
  var n = e.shift(),
      a = n.curNumber,
      r = (n.targetNumber - n.curNumber) * n.interval / o,
      s = function s() {
    if (n.time_elapsed += n.interval, r >= 0 && n.targetNumber <= n.curNumber || r < 0 && n.targetNumber >= n.curNumber) n.curNumber = n.targetNumber, n.onChange(n.curNumber), n.finish(), n.component.unschedule(s), 0 != e.length && t(e, o);else switch (n.onChange(n.curNumber), null == n.easeing && (n.easeing = i.LINEAR), n.easeing) {
      case i.LINEAR:
        n.curNumber += r;
        break;

      case i.INVERSE_PROPORTIONAL:
        var l = (n.targetNumber - a) * (o + 1) / (1 - o - 1),
            c = n.time_elapsed;
        n.curNumber = a + l / (c + 1) - l;
    }
  };

  n.component.schedule(s, n.interval);
};

cc._RF.pop();